<?php
include '../inc-config.php';
include "title.php";
echo "<title>$sitetitle</title>";
?>
<br /><br />
<?php
$user = $_SESSION['user'];
$getid = "SELECT * from b_users a, b_templates b where b.templateid=a.templateclass and a.username='$user'";
$getid2 = mysql_query($getid, $forum) or die("Error #1: " . mysql_error());
$getid3 = mysql_fetch_array($getid2);
echo "<link rel='stylesheet' href='templates/$getid3[templatepath]/style.css' type='text/css'>";
if(isset($_GET['userID']))
{
	$userID=$_GET['userID'];
}
else
{
	$userID=$_POST['userID'];
}
$getbanuser = "SELECT * from b_users where userID='$userID'";
$getbanuser2 = mysql_query($getbanuser, $forum) or die("Error #2: " . mysql_error());
$getbanuser3 = mysql_fetch_array($getbanuser2);
if($getid3['status'] >= 2)
{
	if($getbanuser3['status'] > $getid3['status'])
	{
	   die("<table class='maintable'><tr class='headline'><td><center>Ban User</center></td></tr><tr class='forumrow'><td><center>You cannot ban something with the same or higher permissions than yourself</center></td></tr></table>");
	}
	echo "<table class='maintable'><tr class='headline'><td><center>Ban User</center></td></tr>";
	echo "<tr class='forumrow'><td>";
	if(isset($_POST['submit']))
	{
		$banuser="Update b_users set banned='Yes' where userID='$userID'";
		mysql_query($banuser) or die("Error #3: " . mysql_error());
		echo "User Banned";   
	}
	else
	{
		echo "<form action='banuser.php' method='post'>";
		echo "<input type='hidden' name='userID' value='$userID'>";
		echo "Are you sure you want to ban this user?<br>";
		echo "<input type='submit' name='submit' value='Ban User'></form>";
	}
	echo "</td></tr></table>";
}
else
{
	echo "<table class='maintable'>";
	echo "<tr class='headline'><td><center>Post Sticky</center></td></tr>";
	echo "<tr class='forumrow'><td><center>";
	echo "Sorry You must at least be a supermoderator to ban people, please <A href='index.php'>Return to the Forum index</a>.";
	echo "</td></tr></table>";
} 
?>
</center>   
<br /><br />
<center>
